import java.util.Scanner;

/**
 * 计算两个字符串的最大公共字串的长度，字符不区分大小写
 */
public class PublicSubString2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String str1 = scanner.nextLine();
            String str2 = scanner.nextLine();
            String max = str1.length() >= str2.length() ? str1 : str2;
            String min = str1.length() >= str2.length() ? str2 : str1;
            int length = 0;
            String result = "";
            for (int i=0; i<min.length(); i++) {
                for (int j=i+1; j<min.length(); j++) {
                    if (max.contains(min.substring(i,j)) && j-i>length) {
                        length = j-i;
                        result = min.substring(i,j);
                    }
                }
            }
            System.out.println(result.length());
        }
    }
}
